
var _ = require('lodash'),
    entityCollection = require('../../../Base/server/controllers/EntityCollection');

//通过质检指标查找不良类型
exports.findBadTypeByQCNormID = function(qcNormId, completeFun){
    var entity = entityCollection.getEntity('BadTypeBind'),
        qcNormIds = _.isString(qcNormId) ? [qcNormId] : qcNormId;
    entity.find({QCNorm: {$in: qcNormIds}}, null, null, function (err, records) {
        if (err) {
            var newErr = new Error();
            newErr.leval = 9;
            newErr.title = '查询品质记录错误';
            newErr.message = '查询失败，请检查查询参数！';
            completeFun(newErr);
        } else {
            completeFun(null, records);
        }
    });
};